<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>后台登录</title>
		<link rel="stylesheet" type="text/css" href="/css/detailsmusic.css" />
	</head>

	<body>
		<div class="music-lgin">

			<div class="music-lgin-all">
				<!--左手-->
				<div class="music-lgin-left ovhd">
					<div class="music-hand">
						<div class="music-lgin-hara"></div>
						<div class="music-lgin-hars"></div>
					</div>
				</div>

				<!--脑袋-->
				<div class="music-lgin-dh">
					<div class="music-lgin-alls">
						<div class="music-lgin-eyeleft">
							<div class="music-left-eyeball yeball-l"></div>
						</div>
						<div class="music-lgin-eyeright">
							<div class="music-right-eyeball yeball-r"></div>
						</div>
						<div class="music-lgin-cl"></div>
					</div>
					<!--鼻子-->
					<div class="music-nose"></div>
					<!--嘴-->
					<div class="music-mouth music-mouth-ds"></div>
					<!--肩-->
					<div class="music-shoulder-l">
						<div class="music-shoulder"></div>
					</div>
					<div class="music-shoulder-r">
						<div class="music-shoulder"></div>
					</div>
					<!--消息框-->
					<div class="music-news">来了,老弟！</div>
				</div>

				<!--右手-->
				<div class="music-lgin-right ovhd">
					<div class="music-hand">
						<div class="music-lgin-hara"></div>
						<div class="music-lgin-hars"></div>
					</div>
				</div>

			</div>
		<form id="app">
			<!--1-->
			<div class="music-lgin-text">
				<input class="inputname inputs" type="text" v-model="manager.managerName" placeholder="用户名" value=""/>
			</div>
			<!--2-->
			<div class="music-lgin-text">
				<input type="password" class="mima inputs" v-model="manager.managerPassword" placeholder="密码" />
			</div>
			<!--3-->
			<div class="music-lgin-text">
				<input class="music-qd inputs" type="button" @click="sub" value="确定" />
			</div>
		</form>
		</div>

		<script src="http://www.jq22.com/jquery/jquery-1.10.2.js"></script>
		<script src="/js/vue.js" type="text/javascript" charset="utf-8"></script>
		<script src="/js/jquery.js"></script>
		<script type="text/javascript">
			//眼睛 密码部分
			$(".mima").focus(function() {
				$(".music-lgin-left").addClass("left-dh").removeClass("rmleft-dh");
				$(".music-lgin-right").addClass("right-dh").removeClass("right-rmdh");
				$(".music-hand").addClass("no");
			}).blur(function() {
				$(".music-lgin-left").removeClass("left-dh").addClass("rmleft-dh");
				$(".music-lgin-right").removeClass("right-dh").addClass("right-rmdh");
				$(".music-hand").removeClass("no");

			})
			//点击小人出来
			$(".inputname").focus(function() {
				$(".music-lgin-all").addClass("block");
				$(".music-news").addClass("no")
			})
			//点击小人消失

			//          $(".music-qd").focus(function(){
			//          	$(".music-lgin-all").removeClass("block")
			//          })


			//注册正则 简单判断
			var vm = new Vue({
				el: "#app",
				data: {
					manager:{
						managerName:"",
						managerPassword:""
					}

				},
				methods:{
					sub:function () {
						if(($('.inputname').val()=='')){
							$(".music-news").html("请输入名称")
						}else if(($('.mima').val()=='')){
							$(".music-news").html("请输入密码")
							$(".music-news").addClass("block")
						}else{
							var vs = this;
							$.ajax({
								url:"/freshmarket/manager/login",
								data:vs.manager,
								dataType:"json",
								type:"get",
								success:function (data) {
									if(data.success) {
										alert(data.message);
										window.location.href="/index";
									}else if(data.code == 302){
										alert(data.message);
										window.location.href="/index";
									}
								}
							});
						}
					}
				}
			});

		</script>

	</body>

</html>